Fix dtype mismatch in resolution analyses#148
Conversation
|
Hi @alxndrkalinin, Thanks for the finding and PR, I'll just wait for the CLI to finish running and will then aprove the PR merge and prepare a new NanoPyx release with the fix. Best, |
|
Hi again @alxndrkalinin, Could you give me some details about which python version you're running and the cython and numpy version you have installed in your env? Best, |
|
Hi @brunomsaraiva, Thanks for checking. Turns out, I had two numpy dist-info directories (1.26.4 and 2.3.4). pkg_resources was seeing the 1.26.4 metadata even though Python was actually using 2.3.4 - so version check passed and allowed running tests, while I was actually using numpy 2.x. I tested to confirm:
Not sure what your plans are for numpy 2.x support, but one option to support both is by explicitly casting FFT output to This makes tests pass with numpy either <2 and 2.x, so I committed this change here. Let me know what you think. |
|
Hi @alxndrkalinin, Thanks for the fix for both numpy versions. Letting CI tests ran and if everything works as expected will merge the PR. Regarding numpy > 2 support, it is something we are aiming to support and will work on it once we find some time to fully test numpy>2 integration across all methods. |
There is an issue in resolution analyses (decorrelation and FRC), where Cython
cdef complex[:, :]defaults to double complex (complex128), butnp.fft.fft2()onfloat32input returnscomplex64.Actually, current tests fail on
main, e.g.each raise
Explicitly specifying
float complexsolves the issue and all three tests pass.